﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace paipai
{
    public partial class AddGoods : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            #region   session check & init
            if (!IsPostBack)
            {
                if (Session["UserID"] != null)
                {
                    ViewState.Add("UserID", Session["UserID"]);
                }
                else
                {
                    Response.Redirect("Login.aspx");
                }
            }
            #endregion
        }

        protected void ImageButton_Submit_Click(object sender, ImageClickEventArgs e)
        {
            var cCommodity = new Bll.CCommodity();
            cCommodity.ID = System.Guid.NewGuid().ToString();
            cCommodity.name = TextBox_PName.Text.Trim();
            cCommodity.ownerID = "                  ";
            cCommodity.ownerType = 'a';
            cCommodity.status = 1;
            cCommodity.pic = "                      ";
            cCommodity.Category = "                  ";
            cCommodity.commodityID = TextBox_PID.Text.Trim();
            cCommodity.Quantity = Convert.ToInt16(TextBox_Quantity.Text.Trim()) ;
            cCommodity.RetailPrice = Convert.ToDecimal(TextBox_RetailPrice.Text.Trim());
            cCommodity.StartPrice = Convert.ToDecimal(TextBox_StartPrice.Text.Trim());
            cCommodity.CostPrice = Convert.ToDecimal(TextBox_CostPrice.Text.Trim());
            cCommodity.ShipFees = Convert.ToDecimal(TextBox_ShipFees.Text.Trim());
            cCommodity.Title = TextBox_Title.Text.Trim();
            cCommodity.introduction = TextBox_Description.Text.Trim();

            Bll.CCommodityManage.Save(cCommodity);
        }

    }
}
